package com.aeye.mbr.upms.server.controller.manage;

import com.aeye.mbr.common.base.BaseController;
import com.aeye.mbr.common.result.BootstrapTableParams;
import com.aeye.mbr.upms.common.constant.UpmsResult;
import com.aeye.mbr.upms.rpc.api.UpmsAreaService;
import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

/**
 * 区划controller
 * Created by shuaeye.mbr on 2017/2/6.
 */
@RestController
@Api(value = "接口服务", description = "接口服务")
@RequestMapping("/manage/api")
public class UpmsRestController extends BaseController {
    private static Logger _log = LoggerFactory.getLogger(UpmsRestController.class);

    @ApiOperation(value = "版本检测")
    @RequestMapping(value = "/version/check/{terminalType}", method = RequestMethod.POST)
    public ResponseEntity<UpmsResult> versionCheck(@PathVariable("terminalType") String terminalType) {
        //TODO add logic here
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("version","1.0.0");
        jsonObject.put("url","http://sw.bos.baidu.com/sw-search-sp/software/d4e97ccd4bd9f/jdk-8u144-windows-i586_8.0.1440.1.exe");
        return new ResponseEntity(UpmsResult.success(jsonObject),HttpStatus.OK);
    }

    @ApiOperation(value = "参数获取")
    @RequestMapping(value = "/param/get/{terminalType}", method = RequestMethod.POST)
    public ResponseEntity<UpmsResult> paramGet(@PathVariable("terminalType") String terminalType) {
        //TODO add logic here
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("param1","value1");
        jsonObject.put("param2","value2");
        return new ResponseEntity(UpmsResult.success(jsonObject),HttpStatus.OK);
    }

}
